//
//  ZSNFirstViewController.swift
//  ZSNRongHeMPK
//
//  Created by zhaosuning on 2022/2/11.
//

import UIKit
import AVKit

class ZSNFirstViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.title = "首页"
        self.view.backgroundColor = UIColor.white
        // Do any additional setup after loading the view.
        
        let btnClick = UIButton.init(frame: CGRect(x: 30, y: 100, width: 200, height: 50))
        btnClick.backgroundColor = UIColor.yellow
        btnClick.setTitle("点击进入MPK页", for: .normal)
        btnClick.layer.cornerRadius = 23.5
        btnClick.titleLabel?.textAlignment = .center
        btnClick.layer.masksToBounds = true
        btnClick.titleLabel?.font = UIFont.systemFont(ofSize: 18)
        btnClick.setTitleColor(UIColor(red: 50/255, green: 71/255, blue: 1, alpha: 1), for: UIControl.State.normal)
        btnClick.addTarget(self, action: #selector(btnClickClick), for: UIControl.Event.touchUpInside)
        self.view.addSubview(btnClick)
        
        let btnGetClick = UIButton.init(frame: CGRect(x: 30, y: 300, width: 220, height: 50))
        btnGetClick.backgroundColor = UIColor.green
        btnGetClick.setTitle("查看频道前AVAudioSession", for: .normal)
        btnGetClick.layer.cornerRadius = 23.5
        btnGetClick.titleLabel?.textAlignment = .center
        btnGetClick.layer.masksToBounds = true
        btnGetClick.titleLabel?.font = UIFont.systemFont(ofSize: 15)
        btnGetClick.setTitleColor(UIColor(red: 50/255, green: 71/255, blue: 1, alpha: 1), for: UIControl.State.normal)
        btnGetClick.addTarget(self, action: #selector(btnGetClickAction), for: UIControl.Event.touchUpInside)
        self.view.addSubview(btnGetClick)

    }
    
    
    @objc func btnClickClick() {
        let vc = ZSNRHMPKViewController.init()
        self.navigationController?.pushViewController(vc, animated: true)
        NSLog("打印了 点击进入ZSNMPKViewController页")
    }
    

    @objc func btnGetClickAction() {
        //cha
        
        let session = AVAudioSession.init()
        let a = session.availableCategories
        let b = session.availableModes
        let c = session.categoryOptions
        
        let d = session.category
        let e = session.mode
        let f = session.currentRoute
        //let g = session.se
        
        
        
        
        NSLog("打印了 First页 category \(d)   mode \(e)  options\(c)  route \(f)")
        NSLog("打印了 First页 options\(c)")
    }
    

}
